import { checkForm } from "./formRuler";
import rules from "@/utils/rules";
// isBoolean:true, // 是否为Boolean类型, 参数是否必须为boolen类型，不是根据options个数判断，是根据后台字段类型要求判断
const emailServiceForm = {
  isOpenEmail: true,
  isAllsiteUse: true,
  smtpservice: '',
  smtpport: '',
  sendAccount: '',
  emailPassword: '',
  sslUse: '',
  formState: [{
    children: [
      {
        value: false,
        param: "isOpenEmail",
        rule: {
          required: true,
          validator: checkForm,
          trigger: ["change"],
          msg1: "",
          msg2: "",
          api: "",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "是否开启邮件服务:",
        type: "radio",
        isBoolean: true, // 是否为Boolean类型
        options: ["是", "否"],
        tips: "",
      },
      {
        value: false,
        param: "isAllsiteUse",
        rule: {
          required: true,
          validator: checkForm,
          trigger: ["change"],
          msg1: "",
          msg2: "",
          api: "",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "是否全站全统一使用:",
        type: "radio",
        isBoolean: true, // 是否为Boolean类型
        options: ["是", "否"],
        tips: "",
      },
      {
        value: "",
        placeholder: "请输入",
        param: "smtpservice",
        rule: {
          required: true,
          validator: checkForm,
          trigger: ["blur"],
          msg1: "请输入邮件服务器主机地址",
          msg2: "",
          api: "",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "SMTP服务器:",
        extra: "设置 SMTP 邮件服务器主机地址，不推荐使用QQ个人邮箱",
        beforeText: "",
        afterText: "",
        type: "textInput",
        associated: "",
        associatedValue: "",
      },
      {
        value: "",
        placeholder: "请输入",
        param: "smtpport",
        rule: {
          required: true,
          validator: checkForm,
          trigger: ["blur"],
          msg1: "请输入邮件服务器端口号",
          msg2: "",
          api: "",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "SMTP端口:",
        extra:
          "邮件服务器端口，25默认http协议，465默认为https协议，推荐使用465",
        beforeText: "",
        afterText: "",
        type: "textInput",
        associated: "",
        associatedValue: "",
      },
      {
        value: "",
        placeholder: "请输入",
        param: "sendAccount",
        rule: {
          required: true,
          validator: rules.email,
          trigger: ["blur"],
          msg1: "请输入邮箱",
          msg2: "邮箱格式不正确",
          api: "",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "发件邮箱:",
        beforeText: "",
        afterText: "",
        type: "textInput",
        associated: "",
        associatedValue: "",
      },
      {
        value: "",
        placeholder: "请输入",
        param: "emailPassword",
        rule: {
          required: true,
          validator: checkForm,
          trigger: ["blur"],
          msg1: "请输入邮箱密码或授权码",
          msg2: "",
          api: "",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "邮箱密码:",
        extra: "一般为验证邮箱密码，如果使用网易邮箱，请填写授权码",
        beforeText: "",
        afterText: "",
        type: "textInput",
        associated: "",
        associatedValue: "",
      },
      {
        value: false,
        param: "sslUse",
        rule: {
          required: true,
          validator: checkForm,
          trigger: ["change"],
          msg1: "",
          msg2: "",
          api: "",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "是否使用SSL协议:",
        type: "radio",
        isBoolean: true, // 是否为Boolean类型
        options: ["是", "否"],
        tips: "",
      },
    ]
  }],
}


export { emailServiceForm };
